﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data.SqlClient;
using System.Data;

namespace DA
{
    public class NhaSanXuatDB
    {
        public List<NhaSanXuatData> getAllNhaSanXuat()
        {
            List<NhaSanXuatData> list = new List<NhaSanXuatData>();
            ConnectionDB cn = new ConnectionDB();
            string sql = "Select * from NhaSanXuat";
            cn.Cmd.CommandText = sql;
            SqlDataReader reader = cn.Cmd.ExecuteReader();
            NhaSanXuatData data = null;
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    data = new NhaSanXuatData();
                    data.MaNSX = reader.GetInt32(0);
                    data.TenNSX = reader.GetString(1);
                    list.Add(data);
                }
            }
            return list;
        }
    }
}
